﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CASubmitOrder.aspx.cs"
    Inherits="RN.ERP.Web.CA.CASubmitOrder" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><%=PageTitle %></title>
    <link href="../Styles/style.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/style_msg.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../Scripts/iepngfix_tilebg.js"></script>
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript">
        function OpenAlert(text) {
            $.ligerDialog.warn(text);
            return false;
        }
        $(function () {
            $(".DownPay").click(function () {
                if ($("#txtMobile").val() == "") {
                    OpenAlert("请填写移动电话！");
                    return false;
                }
                var reg = /^(13[0-9]|15[0-9]|18[0-9])[0-9]{8}$/;
                if (!$("#txtMobile").val().match(reg)) {
                    OpenAlert("移动电话格式不正确！");
                    return false;
                }

                if ($("#hidGroup").val() == "CA03" && $("#txtNotice").val() == "") {
                    OpenAlert("请填写备注，说明补办理由！");
                    return false;
                }
                if ($("#txtNotice").val().length > 250) {
                    OpenAlert("备注说明超过250字！");
                    return false;
                }
                if ($("#txtTitle").val() == "" || $("#txtLinkMan").val() == "" || $("#txtTel").val() == ""
                || $("#txtPostCode").val() == "" || $("#txtAddress").val() == "") {
                    OpenAlert("请完善信息！");
                    return false;
                }
                if ($("#OrderId").val() == "") {
                    OpenAlert("操作失败！");
                    return false;
                }
                $.ligerDialog.confirm("请确认已进行汇款？", DownPay);
            });
            $(".return_a").click(function () {
                parent.window.CloseWin("0");
                window.parent.$.ligerDialog.close(); ////关闭dialog
                parent.$(".l-dialog,.l-window-mask").hide(); ////去除父窗体遮罩层
            });
            $(".pay_class").click(function () {
                if ($("#txtMobile").val() == "") {
                    OpenAlert("请填写移动电话！");
                    return false;
                }
                var reg = /^(13[0-9]|15[0-9]|18[0-9])[0-9]{8}$/;
                if (!$("#txtMobile").val().match(reg)) {
                    OpenAlert("移动电话格式不正确！");
                    return false;
                }

                if ($("#hidGroup").val() == "CA03" && $("#txtNotice").val() == "") {
                    OpenAlert("请填写备注，说明补办理由！");
                    return false;
                }
                if ($("#txtNotice").val().length > 250) {
                    OpenAlert("备注说明超过250字！");
                    return false;
                }
                if ($("#txtTitle").val() == "" || $("#txtLinkMan").val() == "" || $("#txtTel").val() == ""
                || $("#txtPostCode").val() == "" || $("#txtAddress").val() == "") {
                    OpenAlert("请完善信息！");
                    return false;
                }
                if ($("#OrderId").val() == "") {
                    OpenAlert("操作失败！");
                    return false;
                }
                var datas = $("#hidGuid").val() + "@" + $("#txtTitle").val() + "@" + $("#txtLinkMan").val() + "@" + $("#txtAddress").val() + "@"
                + $("#txtMobile").val() + "@" + $("#txtTel").val() + "@" + $("#txtPostCode").val() + "@" + $("#txtNotice").val();
                $.ajax({
                    async: false,
                    url: "CASubmitOrder.aspx/OptOrders",
                    data: "{ 'datas':'" + datas + "','status':'1'}",
                    type: "post",
                    cache: false,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var json = eval('(' + data.d + ')');
                        if (json.Message == "提交成功！") {
                            $("#tbPayBefore").css("display", "none");
                            $("#tbPayAfter").css("display", "block");
                            $("#form1").attr("action", $("#hdnUrl").val());
                            $("#form1").attr("method", "post");
                            $("#form1").attr("target", "_blank");
                            $("#form1").submit();
                            $("#form1").attr("action", "");
                            $("#form1").attr("method", "");
                            $("#form1").attr("target", "");
                            $("input[type='text']").attr("disabled", true);
                            $("#txtNotice").attr("disabled", true);
                        }
                        else {
                            OpenAlert("操作失败！");
                        }
                    }
                });
            })
        })
        function CloseWin() {
            parent.window.CloseWin("1");
            window.parent.$.ligerDialog.close(); ////关闭dialog
            parent.$(".l-dialog,.l-window-mask").hide(); ////去除父窗体遮罩层
        }
        function DownPay(arg) {
            if (arg) {
                var datas = $("#hidGuid").val() + "@" + $("#txtTitle").val() + "@" + $("#txtLinkMan").val() + "@" + $("#txtAddress").val() + "@"
                + $("#txtMobile").val() + "@" + $("#txtTel").val() + "@" + $("#txtPostCode").val() + "@" + $("#txtNotice").val();
                $.ajax({
                    async: false,
                    url: "CASubmitOrder.aspx/OptOrders",
                    data: "{ 'datas':'" + datas + "','status':'2'}",
                    type: "post",
                    cache: false,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        var json = eval('(' + data.d + ')');
                        if (json.Message == "提交成功！") {
                            $.ligerDialog.warn(json.Message, "", CloseWin);
                        }
                        else {
                            OpenAlert(json.Message);
                        }
                    }
                });
            }
        }
    </script>
    <style type="text/css">
        .IE6png
        {
            behavior: url("../Scripts/iepngfix.htc");
        }
        .text_css
        {
            border: 2px;
            height: 24px;
            line-height: 24px;
        }
        .icon_li
        {
            padding: 0px 20px;
            background: url(../images/icon_li.jpg) repeat-x;
            float: right;
        }
        .icon_li a
        {
            line-height: 48px;
            display: block;
            color: #936205;
            font-size: 18px;
            font-weight: bold;
            text-align: center;
        }
        .icon_li a:hover
        {
            text-decoration: none;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:HiddenField ID="hdnUrl" runat="server" ClientIDMode="Static" />
        <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
                <td width="16" class="title_lbg IE6png">
                </td>
                <td width="24" class="title_t IE6png">
                </td>
                <td width="900" class="title_libg IE6png">
                    提交订单
                </td>
                <td width="17" class="title_rbg IE6png">
                </td>
            </tr>
            <tr id="tbCorp" runat="server">
                <td class="border_lbg IE6png">
                    &nbsp;
                </td>
                <td colspan="2" style="padding-top: 16px; padding-left: 6px; padding-right: 6px;">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab" style="margin-bottom: 15px;">
                        <tr>
                            <td width="15%" bgcolor="#f2f2f2">
                                <strong>订单号</strong>
                            </td>
                            <td width="30%" style="text-align: left">
                                <asp:Label ID="lbCode" runat="server"></asp:Label>
                            </td>
                            <td width="15%" bgcolor="#f2f2f2">
                                <strong>发票抬头</strong>
                            </td>
                            <td height="31" style="text-align: left;">
                                <asp:TextBox ID="txtTitle" runat="server" Width="85%" CssClass="text_css"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#f2f2f2">
                                <strong>联系人</strong>
                            </td>
                            <td style="text-align: left">
                                <asp:TextBox ID="txtLinkMan" runat="server" Width="85%" CssClass="text_css"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtLinkMan"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red"></asp:RequiredFieldValidator>
                            </td>
                            <td bgcolor="#f2f2f2">
                                <strong>联系电话</strong>
                            </td>
                            <td style="text-align: left">
                                <asp:TextBox ID="txtTel" runat="server" Width="85%" CssClass="text_css"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtTel"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red"></asp:RequiredFieldValidator>
                                <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtTel"
                                    ErrorMessage="*" ValidationGroup="aa" ValidationExpression="^[0-9]*$" ForeColor="Red"></asp:RegularExpressionValidator>--%>
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#f2f2f2">
                                <strong>移动电话</strong>
                            </td>
                            <td style="text-align: left">
                                <asp:TextBox ID="txtMobile" runat="server" Width="85%" CssClass="text_css"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtMobile"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtMobile"
                                    ErrorMessage="*" ValidationGroup="aa" ValidationExpression="^(13[0-9]|15[0-9]|18[0-9])[0-9]{8}$"
                                    ForeColor="Red"></asp:RegularExpressionValidator>
                            </td>
                            <td bgcolor="#f2f2f2">
                                <strong>邮编</strong>
                            </td>
                            <td style="text-align: left">
                                <asp:TextBox ID="txtPostCode" runat="server" Width="85%" CssClass="text_css"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtPostCode"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtPostCode"
                                    ErrorMessage="*" ValidationGroup="aa" ValidationExpression="^[0-9]*$" ForeColor="Red"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#f2f2f2">
                                <strong>发票寄送地址</strong>
                            </td>
                            <td style="text-align: left" colspan="3">
                                <asp:TextBox ID="txtAddress" runat="server" Width="85%" CssClass="text_css"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtAddress"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#f2f2f2">
                                <strong>备注</strong><br />
                                <span style="color: Red; padding-left: 2px;">(线下支付，请注明汇款时间和汇款人名称)</span>
                            </td>
                            <td style="text-align: left" colspan="3">
                                <asp:TextBox ID="txtNotice" runat="server" Width="85%" CssClass="text_css" MaxLength="250"
                                    Height="66px" TextMode="MultiLine"></asp:TextBox><span style="color: Red; padding-left: 2px;">(限250字)</span>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtNotice"
                                    ErrorMessage="*" Display="Dynamic" ValidationGroup="aa" ForeColor="Red" Visible="false"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="font-weight: bold; height: 50px; font-size: 20px;">
                                订单总金额：<asp:Label ID="lbSum" runat="server"></asp:Label>元
                            </td>
                        </tr>
                    </table>
                    <table id="tbPayBefore" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"
                        style="margin-top: 15px;">
                        <tr>
                            <td width="327">
                                &nbsp;
                            </td>
                            <td width="360">
                                <div class="fr">
                                    <img src="../images/icon_r.jpg" width="8" height="53" alt="" /></div>
                                <div class="icon_li">
                                    <a href="javascript:void(0);" class="DownPay">线下汇款确认申请</a></div>
                                <div class="fr">
                                    <img src="../images/icon_l.jpg" width="8" height="53" alt="" /></div>
                            </td>
                            <td width="120" style="text-align: center;">
                                <div class="icon01 IE6png">
                                    <a href="javascript:void(0);" class="pay_class">银联支付</a>
                                </div>
                            </td>
                            <td width="189">
                                <div class="icon02 IE6png">
                                    <a href="javascript:void(0);" class="return_a">返回</a></div>
                            </td>
                            <td width="329">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                    <table id="tbPayAfter" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"
                        style="margin-top: 15px; display: none;">
                        <tr>
                            <td width="422">
                                &nbsp;
                            </td>
                            <td width="189" style="text-align: center;">
                                <div class="icon01 IE6png">
                                    <asp:LinkButton ID="lbtnUp" runat="server" ClientIDMode="Static" OnClick="lbtnUp_Click">支付完成</asp:LinkButton>
                                </div>
                            </td>
                            <td width="189">
                                <div class="icon02 IE6png">
                                    <asp:LinkButton ID="lbtnError" runat="server" ClientIDMode="Static" OnClick="lbtnUp_Click">支付遇到问题</asp:LinkButton>
                                </div>
                            </td>
                            <td width="423">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </td>
                <td class="border_rbg IE6png">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="border_lconer IE6png" headers="17">
                    &nbsp;
                </td>
                <td colspan="2" class="border_bottomli IE6png" height="17">
                    &nbsp;
                </td>
                <td class="border_rconer IE6png" headers="17">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <asp:HiddenField ID="hidGuid" runat="server" />
    <asp:HiddenField ID="hidGroup" runat="server" />
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    </telerik:RadWindowManager>
    <input type="hidden" name="OrderId" id="OrderId" runat="server" />
    <input type="hidden" name="ProductType" id="ProductType" runat="server" />
    <input type="hidden" name="Uid" id="Uid" runat="server" />
    </form>
</body>
</html>
